package com.wbxqy.car_management_system.mapper;

import com.wbxqy.car_management_system.entity.CarRequest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用车申请表 Mapper 接口
 * </p>
 *
 * @author wbxqy
 * @since 2024-07-04
 */
@Mapper
public interface CarRequestMapper extends BaseMapper<CarRequest> {
    @Select("SELECT * FROM t_car_request_wbxqy WHERE driver_id_wbxqy = #{driverId} AND status_wbxqy = 'A'")
    List<CarRequest> findApprovedRequestsByDriverId(@Param("driverId") int driverId);

    @Select("SELECT * FROM t_car_request_wbxqy WHERE car_id_wbxqy = #{carId} AND status_wbxqy = 'A'")
    List<CarRequest> findApprovedRequestsByCarId(@Param("carId") int carId);
}
